<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="center_common" />
<title>修改密码</title>
<style type="text/css">
em.error {
	height: 18px;
	display: inline-block;
	vertical-align: middle;
	margin-right: 2px;
	margin-left: 20px;
	background: url("${ctxWebStatic}/images/error_img.png") no-repeat 0px
		0px;
	padding-left: 24px;
	color: #d3001e;
	font-size: 16px;
	font-family: "微软雅黑";
}
</style>
<script type="text/javascript">
	var subflag = false;

	$(document).ready(function() {
		if ("${resultMessage}" != "") {
			alert("${resultMessage}");
		}

		$("#updateForm").validate({
			rules : {
				checkPassword : {
					required : true,
					minlength : 8,
					onkeyup : false,
					remote : {
						type : "POST",
						url : "${ctxWeb}/userInfo/checkPassword", //servlet
						data : {
							checkPassword : function() {
								return $("#checkPassword").val();
							}
						}
					}
				},
				password : {
					required : true,
					minlength : 8
				},
				cPassword : {
					required : true,
					equalTo : "#password"
					
				}
			},

			messages : {
				checkPassword : {
					required : '请输入原密码',
					minlength : '原密码错误，请重新输入',
					remote : '原密码错误，请重新输入'
				},
				password : {
					required : "请输入新密码",
					minlength : "至少输入八位密码"
				},
				cPassword : {
					required : "请输入确认密码",
					equalTo : "两次输入不一致"
					
				}
			},

			errorElement : "em",
		});
	});

	function sub() {
		if (subflag) {
			return;
		}
		var checkFlag = true;
		if (!$("#updateForm").valid()) {
			checkFlag = false;
		}
		if (!checkFlag) {
			return false;
		}
		$("#updateForm").submit();
		subflag = true;
	}
</script>
</head>
<body>
	<!-- 右边部分 -->
	<div class="col-sm-10 pad20 pad_10">
		<div class="Credit_right">
			<!--个人信息-->
			<div class="goods_detail_info_box mar_16 clearfix">
				<h3>
					<span>修改密码</span>

				</h3>
				<div class="company_msg clearfix">
					<form action="${ctxWeb}/userInfo/update" id="updateForm"
						method="post">
						<div class="form-group clearfix">
							<label class="col-sm-3 col-xs-4 input_info control-label">
								原密码： </label>
							<div class="col-sm-9 col-xs-8 input_left">
								<input type="password" id="checkPassword" name="checkPassword" maxlength="20" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false"
									class="form-control" placeholder="请输入原密码">
							</div>
						</div>

						<div class="form-group clearfix">
							<label class="col-sm-3 col-xs-4 input_info control-label">
								新密码： </label>
							<div class="col-sm-9 col-xs-8 input_left">
								<input type="password" id="password" name="password" maxlength="20" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false"
									class="form-control" placeholder="请输入新密码">
							</div>
						</div>

						<div class="form-group clearfix">
							<label class="col-sm-3 col-xs-4 input_info control-label">
								确认密码： </label>
							<div class="col-sm-9 col-xs-8 input_left">
								<input type="password" id="cPassword" name="cPassword" maxlength="20" onpaste="return false" oncontextmenu="return false" oncopy="return false" oncut="return false"
									class="form-control" placeholder="请输入新密码">
							</div>
						</div>
					</form>
					<p class="register_btn  mar_t30 col-sm-offset-3 col-xs-offset-4">
						<a href="javascript:void(0)" class="modify_item" onclick="sub()">修改</a>

					</p>
				</div>
			</div>
			<!--联系人信息结束-->
		</div>
	</div>
	<!-- 右边部分 end-->
</body>
</html>
